**********************************************************************

******Replication Data for: The causes and consequences***********

**************of COVID-19 misperceptions**********************

*******************June 17, 2020**********************

set more off
sysuse survey.dta

****CODING****

**Income
recode income 9=.
replace income = income-1

**Ideology
recode inequality 3/4=-1 2=0 0/1=1, gen(inequalityY)
recode enviro 3/4=-1 2=0 0/1=1, gen(enviroY)
recode immig 3/4=-1 2=0 0/1=1, gen(immigY)
recode ahead 3/4=1 2=0 0/1=-1, gen(aheadY)
recode stliving 3/4=-1 2=0 0/1=1, gen(stlivingY)

gen pideol = ((inequalityY+enviroY+immigY+aheadY+stlivingY)+5)/10

**Religiosity
recode relig 5=. 1=3 2=2 3=1 4=0

**Residence
recode urban 1=4 2=3 3=2 4=1 5=0

**News Exposure
egen newsexp = rowtotal(cbc_y-othern_y)
gen lnewsexp = log(newsexp+1)
replace lnewsexp = lnewsexp/2.995732 

**Social Media
egen socialexp = rowtotal(twitter_y-other_y)
gen lsocialexp = log(socialexp+1)
replace lsocialexp = lsocialexp/2.397895

**Political Discussion
recode discuss_fam 1=0 2=1 3=2 4=3 5=4 6=.
recode discuss_friend 1=0 2=1 3=2 4=3 5=4 6=.
recode discuss_work 1=0 2=1 3=2 4=3 5=4 6=.

gen ftfdiscuss = (discuss_fam+discuss_friend+discuss_work)/12
recode onlinedis 1=0 2=1 3=2 4=3 5=4 6=.
replace onlinedis = onlinedis/4

**COVID Serious
recode serious_self 1=3 2=2 3=1 4=0
recode serious_cdns 1=3 2=2 3=1 4=0

gen covidserious = (serious_self+serious_cdns)/6

**COVID Misperceptions
recode vid_flu 1=4 2=3 5=2 3=1 4=0
recode vid_water 1=4 2=3 5=2 3=1 4=0
recode vid_bioweap 1=4 2=3 5=2 3=1 4=0
recode vid_homeo 1=4 2=3 5=2 3=1 4=0
recode vid_bats 1=4 2=3 5=2 3=1 4=0
recode vid_summer 1=4 2=3 5=2 3=1 4=0
recode vid_vitc 1=4 2=3 5=2 3=1 4=0
recode vid_pharma 1=4 2=3 5=2 3=1 4=0
recode vid_hightemp 1=4 2=3 5=2 3=1 4=0

gen covidmisinfo = (vid_flu+vid_water+vid_bioweap+vid_homeo+vid_bats+vid_summer+vid_vitc+vid_pharma+vid_hightemp)/36

**Social Distance
recode sd_home 1=1 else=0
recode sd_crowd 1=1 else=0
recode sd_peak 1=1 else=0
recode sd_contact 1=1 else=0
recode sd_stockup 1=1 else=0
recode sd_distance 1=1 else=0
recode sd_virtualmeet 1=1 else=0
recode sd_onlineshop 1=1 else=0
recode sd_travel 1=1 else=0
recode sd_transit 1=1 else=0

factor sd_home-sd_transit, pcf
rotate
predict sd1 sd2

egen minsd1 = min(sd1)
replace sd1 = sd1+abs(minsd1)
drop minsd1
egen maxsd1 = max(sd1)
replace sd1 = sd1/maxsd1
drop maxsd1

egen minsd2 = min(sd2)
replace sd2 = sd2+abs(minsd2)
drop minsd2
egen maxsd2 = max(sd2)
replace sd2 = sd2/maxsd2
drop maxsd2

**Trust in Experts
recode t_expert 6=2 1=4 2=3 3=2 4=1 5=0
recode t_econ 6=2 1=4 2=3 3=2 4=1 5=0
recode t_sci 6=2 1=4 2=3 3=2 4=1 5=0
recode t_doc 6=2 1=4 2=3 3=2 4=1 5=0
recode t_prof 6=2 1=4 2=3 3=2 4=1 5=0

gen ai = (t_expert+t_sci+t_doc+t_econ+t_prof)/20

**Science Literacy
recode sci1 1=1 else=0
recode sci2 1=1 else=0
recode sci3 2=1 else=0
recode sci4 1=1 else=0
recode sci5 2=1 else=0
recode sci6 1=1 else=0
recode sci7 2=1 else=0

gen scilit = (sci1+sci2+sci3+sci4+sci5+sci6+sci7)/7

**Pseudoscience
recode lucky 6=2 1=4 2=3 3=2 4=1 5=0
recode faithheal 6=2 1=4 2=3 3=2 4=1 5=0
recode homeo 6=2 1=4 2=3 3=2 4=1 5=0
recode extraterr 6=2 1=4 2=3 3=2 4=1 5=0
recode psychic 6=2 1=4 2=3 3=2 4=1 5=0
recode astrol 6=2 1=4 2=3 3=2 4=1 5=0

gen pseudo = (lucky+faithheal+homeo+extraterr+psychic+astrol)/24

***********************************************

*****MODELS*****

*Social Media as IV
reg covidmisinfo lsocialexp lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo A
reg covidserious lsocialexp lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo B
reg sd1 lsocialexp lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo C

coefplot (A, label(Misperceptions))(B, label(Concern))(C, label(Social Distancing)) ///
	, levels(95) keep(lnewsexp lsocialexp echo_b ftfdiscuss onlinedis) scheme(plottig) ///
	coeflabels(lnewsexp = "News Exposure" lsocialexp = "Social Media Exposure" ///
	ftfdiscuss = "Offline Discussion" onlinedis = "Online Discussion")  ///
	xline(0) xtitle("Effect on outcome (0-1)") legend(ring(0) position(5) region(lc(gs14))) ///
	grid(within glc(gs14) glw(vvthin)) xlab(, glc(gs14) glw(vvthin)) plotr(fc(white)) scale(1.2)
graph export "figures/fig2.eps"

*Misinformation as IV
reg covidserious covidmisinfo lsocialexp lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo D
reg sd1 covidmisinfo lsocialexp lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo E

*Misinformation as IV
reg covidserious covidmisinfo pseudo ai scilit pideol lsocialexp lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo F
reg sd1 covidmisinfo pseudo ai scilit pideol lsocialexp lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo G

coefplot  (D, label(No Controls))(F, label(Controls)) ///
	, levels(95) keep(covidmisinfo pseudo ai scilit pideol lnewsexp lsocialexp) scheme(plottig) ///
	coeflabels(pseudo = "Pseudoscience" covidmisinfo = "Misperceptions" ai = "Anti-intellectualism" ///
	scilit = "Science Literacy" pideol = "Ideology"	lnewsexp = "News Exposure" lsocialexp = "Social Media Exposure") ///
	xline(0) xtitle("Effect on Concern (0-1)") title("COVID-19 Concern") ///
	legend(ring(0) position(5) region(lc(gs14))) name(A, replace) ///
	grid(within glc(gs14) glw(vvthin)) xlab(, glc(gs14) glw(vvthin)) plotr(fc(white)) 

coefplot  (E, label(No Controls))(G, label(Controls)) ///
	, levels(95) keep(covidmisinfo pseudo ai scilit pideol lnewsexp lsocialexp) scheme(plottig) ///
	coeflabels(pseudo = "Pseudoscience" covidmisinfo = "Misperceptions" ai = "Anti-intellectualism" ///
	scilit = "Science Literacy" pideol = "Ideology"	lnewsexp = "News Exposure" lsocialexp = "Social Media Exposure") ///
	xline(0) xtitle("Effect on Social Distancing (0-1)") title("Social Distancing") ///
	legend(ring(0) position(5) region(lc(gs14))) name(B, replace) ///
	grid(within glc(gs14) glw(vvthin)) xlab(, glc(gs14) glw(vvthin)) plotr(fc(white))
	
graph combine A B, graphr(margin(zero)) iscale(1.2) col(2) xsize(9)
graph export "figures/fig3.eps"

esttab A B C D E F G, star(* 0.1 ** 0.05 *** 0.01) se(2) r2(2) b(2)

**Appendix
qui: reg covidmisinfo twitter_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo Twitter
qui: reg covidmisinfo fb_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo Facebook
qui: reg covidmisinfo insta_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo Instagram
qui: reg covidmisinfo youtube_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo YouTube
qui: reg covidmisinfo reddit_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo Reddit
qui: reg covidmisinfo linkedin_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo LinkedIn
qui: reg covidmisinfo tumblr_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo Tumblr
qui: reg covidmisinfo whatsapp_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo WhatsApp
qui: reg covidmisinfo snapchat_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo Snapchat
qui: reg covidmisinfo wechat_y lnewsexp ftfdiscuss onlinedis income educ age relig urban french female i.region [pw=wgt], beta
eststo WeChat

coefplot Twitter Facebook Instagram YouTube Reddit LinkedIn Tumblr WhatsApp Snapchat WeChat, ///
	scheme(plottig) keep(*_y) l(95) coeflabels(twitter_y = "Twitter" fb_y = "Facebook" insta_y = "Instagram" ///
	youtube_y = "YouTube" reddit_y = "Reddit" linkedin_y = "LinkedIn" tumblr_y = "Tumblr" ///
	whatsapp_y = "WhatsApp" snapchat_y = "Snapchat" wechat_y = "WeChat") xline(0) legend(off) ///
	xtitle("Effect on Misperceptions (0-1)") grid(within glc(gs14) glw(vvthin)) xlab(, glc(gs14) ///
	glw(vvthin)) plotr(fc(white)) xsize(4) ytitle("")
graph export "figures/sup2.eps"

